import random


def active_code_generator(length, count):
    orgin_str = "1234567890abcdefghijklmnhijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    res_dic = {}  # 用字典是为了值作为键提高查找效率

    while len(res_dic) < count:
        res = ""
        for i in range(length):
            res += orgin_str[random.randint(0, len(orgin_str) - 1)]
        if not res_dic.get(res):
            res_dic[res] = 1

    return res_dic.keys()


res = active_code_generator(7, 200)
for i in res:
    print(i)

# 实现的思路很清晰，后面学习了迭代的内容，可以尝试把for循环改成列表解析式。